public class GetNum {
    public static void main(String[] args) {
        //计算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值
        int flag=1;
        int down=1;
        double sum=0;
        while(down<=100){
            sum+=(1.0/down)*flag;
            down++;
            flag=-flag;
        }
        System.out.println(sum);
    }

}
